package com.echo.im.offlinePush.notify;

import com.echo.im.offlinePush.config.ThreadPoolExecutorFactory;

import java.util.concurrent.ExecutorService;
import java.util.concurrent.Executors;

/**
 * 还不够完善还不够完善！！
 *
 * @author: echo
 * @time: 2024-08-19
 */
public abstract class AbstractNotifyService implements NotifyService{

    private static final ExecutorService NOTIFY_THREAD_POOL = ThreadPoolExecutorFactory.getInstance();

    @Override
    public void notify(Long userId, String msg) {
        NOTIFY_THREAD_POOL.submit(() -> doNotify(userId, msg));
    }

    /**
     * 委托子类进行通知
     * @param userId
     * @param content
     */
    protected abstract void doNotify(Long userId, String content);

}
